0,
GTK_PARAM_READABLE));
+ /**
+ * GtkNotebook:has-tab-gap:
+ *
+ * The "has-tab-gap" property defines whether the active tab is draw
+ * with a gap at the bottom. When %TRUE the theme engine uses
+ * gtk_render_extension to draw the active tab. When %FALSE
+ * gtk_render_background and gtk_render_frame are used.
+ *
+ * Since: 3.12
+ */
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boolean ("has-tab-gap",
+ P_("Tab gap"),
+ P_("Active tab is drawn with a gap at the bottom"),
+ TRUE,
+ GTK_PARAM_READABLE));
+
/**
* GtkNotebook::switch-page:
* @notebook: the object which received the signal.
GtkWidget *notebook, *child;
GtkRequisition requisition;
GtkStyleContext *context;
- gint gap_pos;
+ gboolean has_tab_gap;
notebook = GTK_WIDGET (data);
child = gtk_bin_get_child (GTK_BIN (widget));
gtk_widget_get_preferred_size (widget,
&requisition, NULL);
- gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
- gtk_render_extension (context, cr, 0, 0,
- requisition.width, requisition.height,
- gap_pos);
+ gtk_widget_style_get (GTK_WIDGET (notebook),
+ "has-tab-gap", &has_tab_gap,
+ NULL);
+
+ if (has_tab_gap)
+ {
+ gint gap_pos;
+ gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
+ gtk_render_extension (context, cr, 0, 0,
+ requisition.width, requisition.height,
+ gap_pos);
+ }
+ else
+ {
+ gtk_render_background (context, cr, 0, 0,
+ requisition.width,
+ requisition.height);
+
+ gtk_render_frame (context, cr, 0, 0,
+ requisition.width,
+ requisition.height);
+ }
if (child)
gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gint gap_x = 0, gap_width = 0, step = STEP_PREV;
gboolean is_rtl;
+ gboolean has_tab_gap;
gint tab_pos;
GtkStyleContext *context;
gtk_style_context_set_junction_sides (context, junction);
}
+ gtk_widget_style_get (GTK_WIDGET (notebook),
+ "has-tab-gap", &has_tab_gap,
+ NULL);
+
gtk_render_background (context, cr,
x, y, width, height);
- gtk_render_frame_gap (context, cr,
- x, y, width, height,
- tab_pos, gap_x, gap_x + gap_width);
+ if (has_tab_gap)
+ gtk_render_frame_gap (context, cr,
+ x, y, width, height,
+ tab_pos, gap_x, gap_x + gap_width);
+ else
+ gtk_render_frame (context, cr,
+ x, y, width, height);
gtk_style_context_restore (context);
GtkNotebookPrivate *priv;
GtkWidget *widget;
GtkStyleContext *context;
+ gboolean has_tab_gap;
if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
!gtk_widget_get_mapped (page->tab_label) ||
gtk_style_context_save (context);
notebook_tab_prepare_style_context (notebook, page, context, use_flags);
- gtk_render_extension (context, cr,
- page->allocation.x,
- page->allocation.y,
- page->allocation.width,
- page->allocation.height,
- get_tab_gap_pos (notebook));
+ gtk_widget_style_get (GTK_WIDGET (notebook),
+ "has-tab-gap", &has_tab_gap,
+ NULL);
+
+ if (has_tab_gap)
+ {
+ gtk_render_extension (context, cr,
+ page->allocation.x,
+ page->allocation.y,
+ page->allocation.width,
+ page->allocation.height,
+ get_tab_gap_pos (notebook));
+ }
+ else
+ {
+ gtk_render_background (context, cr,
+ page->allocation.x,
+ page->allocation.y,
+ page->allocation.width,
+ page->allocation.height);
+
+ gtk_render_frame (context, cr,
+ page->allocation.x,
+ page->allocation.y,
+ page->allocation.width,
+ page->allocation.height);
+ }
if (gtk_widget_has_visible_focus (widget) &&
priv->cur_page == page)